package cn.java.basic;

public class CreateArray
{
    public static void main(String[] args)
    {
        int nScores[]=new int[5];

        nScores[0]=87;
        nScores[1]=97;
        nScores[2]=65;
        nScores[3]=78;
        nScores[4]=85;
        for (int i = 0; i < 5; i++)
        {
            System.out.println("nScores["+i+"]="+nScores[i]);
        }

        char []cTitles=new char[10];
        cTitles[0]='甲';
        cTitles[1]='乙';
        cTitles[2]='丙';
        cTitles[3]='丁';
        cTitles[4]='戊';
        cTitles[5]='己';
        cTitles[6]='庚';
        cTitles[7]='辛';
        cTitles[8]='壬';
        cTitles[9]='癸';
        for (int i = 0; i < 10; i++)
        {
            System.out.print(cTitles[i]);
        }

        int nScoreReport[]={ 85,74,61,93,72} ;
        String []strBigDipper={"天枢","天璇","天玑","天权","玉衡","开阳","摇光"};

        System.out.println("");
        System.out.println("strBigDipper数组长度是"+strBigDipper.length);

        //数组遍历-foreach
        System.out.print("北斗七星是：");
        for (String s:strBigDipper)
        {
            System.out.print(s+" ");
        }
        System.out.println("");

        //数组越界

        try
        {
            String strAlpha=strBigDipper[7];
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        //二维数组
        int nResults[][]={
                            {1,56},{2,78},{3,92},{4,87},{5,66},
                            {6,77},{7,62},{8,71},{9,68},{10,48}
                         };
        for (int i = 0; i < 10; i++)
        {
            System.out.println(nResults[i][0]+","+nResults[i][1]);
        }

    }
}
